import {Axios, AxiosFile} from "@/utils/fetch";

let Api = {
  login(code, encryptedData, iv, recommend) {
    return Axios({
      url: "/api/index/login",
      method: "POST",
      data: {code, encryptedData, iv, recommend}
    })
  },
  bindMobile(encryptedData, iv) {
    return Axios({
      url: "/api/user/bindMobile",
      method: "POST",
      data: {encryptedData, iv}
    })

  },

  getUserInfo() {
    return Axios({
      url: "/api/user/information",
      method: "POST",
    })
  },


  getBanner(classify) {
    return Axios({
      method: "POST",
      url: "/api/index/banner",
      data: {classify}
    })
  },

  getMainTabs() {
    return Axios({
      method: "POST",
      url: "/api/index/tabs",
    })
  },

  getStoreList(data) {
    return Axios({
      method: "POST",
      url: "/api/index/store",
      data
    })
  },

  getCouponList(com_id) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/coupon",
      data: {com_id}
    })
  },

  receiveCoupon(coupon_id) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/user/getCoupon",
      data: {coupon_id}
    })
  },

  getGoodsClassify(com_id) {
    return Axios({
      method: "POST",
      url: "/api/index/goodsClassify",
      data: {com_id}
    })
  },

  getGoods(data) {
    return Axios({
      method: "POST",
      url: "/api/index/goods",
      data
    })
  },

  gettGoodsDetail(goods_id) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/goodsDetail",
      data: {goods_id}
    })
  },


  getNewsList(data) {
    return Axios({
      method: "POST",
      url: "/api/index/news",
      data
    })
  },

  getNewsClassify(data) {
    return Axios({
      method: "POST",
      url: "/api/index/articleClassify",
      data
    })
  },

  getNewsDetail(article_id) {
    return Axios({
      method: "POST",
      url: "/api/index/detail",
      data: {article_id}
    })
  },


  getShopDetail(com_id, lat, lng) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/storeDetail",
      data: {com_id, lat, lng}
    })
  },

  getShopVipCard(com_id, page) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/card",
      data: {com_id, page}
    })
  },

  collectStore(com_id) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/user/collectStore",
      data: {com_id}
    })
  },

  getTechnicianList(com_id, goods_id) {
    return Axios({
      method: "POST",
      url: "/api/index/technician",
      data: {com_id, goods_id}
    })
  },

  getTimeList(staff_id, goods_id) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/timeList",
      data: {staff_id, goods_id}
    })

  },

  appointment(data) {
    return Axios({
      method: "POST",
      url: "/api/indent/appointment",
      data
    })
  },

  getOrderList(state, page) {
    return Axios({
      method: "POST",
      url: "/api/indent/orderList",
      data: {state, page}
    })
  },

  getMyCouponList(page) {
    return Axios({
      method: "POST",
      url: "/api/user/coupon",
      data: {page}
    })
  },

  getCollectStoreList(page) {
    return Axios({
      method: "POST",
      url: "/api/user/store",
      data: {page}
    })
  },

  getMyVipCardList(card_type, page) {
    return Axios({
      method: "POST",
      url: "/api/user/card",
      data: {card_type, page}
    })
  },

  join(data) {
    return Axios({
      method: "POST",
      url: "/api/user/apply",
      data
    })
  },


  uploadImage(filePath) {
    return AxiosFile({
      loading: true,
      url: "/api/index/uploadImage",
      filePath
    })
  },

  getTechnicianOrderList(state, page) {
    return Axios({
      method: "POST",
      url: "/api/Technician/orderList",
      data: {state, page}
    })
  },

  changeTechnicianInfo(data) {
    return Axios({
      method: "POST",
      url: "/api/Technician/infoEdit",
      data
    })
  },

  startService(order_id, staff_id) {
    return Axios({
      method: "POST",
      url: "/api/Technician/service",
      data: {order_id, staff_id}
    })
  },

  finishService(order_id) {
    return Axios({
      method: "POST",
      url: "/api/Technician/finish",
      data: {order_id}
    })
  },

  cancelService(order_id) {
    return Axios({
      method: "POST",
      url: "/api/Technician/cancelOrder",
      data: {order_id}
    })
  },

  leave(data) {
    return Axios({
      method: "POST",
      url: "/api/Technician/leave",
      data
    })
  },

  getTechnicianWorks(member_id, page) {
    return Axios({
      method: "POST",
      url: "/api/index/works",
      data: {member_id, page}
    })
  },

  editTechnicianWork(data) {
    return Axios({
      method: "POST",
      url: "/api/Technician/worksEdit",
      data
    })
  },

  removeTechnicianWork(works_id) {
    return Axios({
      method: "POST",
      url: "/api/Technician/worksDel",
      data: {works_id}
    })
  },

  getTechnicianComments(page) {
    return Axios({
      method: "POST",
      url: "/api/Technician/evaluate",
      data: {page}
    })
  },

  getTechnicianWages(page) {
    return Axios({
      method: "POST",
      url: "/api/Technician/wage",
      data: {page}
    })
  },

  getTechnicianWithdrawLog(page) {
    return Axios({
      method: "POST",
      url: "/api/Technician/withdrawLog",
      data: {page}
    })
  },

  withdraw(type) {
    return Axios({
      method: "POST",
      url: "/api/Technician/withdraw",
      data: {type}
    })
  },


  cancelOrder(order_id) {
    return Axios({
      method: "POST",
      url: "/api/indent/cancelOrder",
      data: {order_id}
    })
  },

  onlinePay(order_id, discount_type) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/indent/onlinePay",
      data: {order_id, discount_type}
    })
  },
  commentOrder(data) {
    return Axios({
      method: "POST",
      url: "/api/indent/evaluate",
      data
    })
  },
  getWorksDetail(works_id) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/worksDetail",
      data: {works_id}
    })
  },
  getTechnicianInfo(member_id) {
    return Axios({
      method: "POST",
      url: "/api/index/technicianInfo",
      data: {member_id}
    })
  },
  offlinePay(data) {
    return Axios({
      method: "POST",
      url: "/api/indent/offlinePay",
      data
    })
  },
  buyCard(card_id) {
    return Axios({
      method: "POST",
      url: "/api/indent/buyCard",
      data: {card_id}
    })
  },
  getOrderDetail(order_id) {
    return Axios({
      method: "POST",
      url: "/api/indent/orderDetail",
      data: {order_id}
    })
  },
  getConfig(var_name) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/getConfig",
      data: {var_name}
    })
  },
  getShopNotice(com_id) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/notice",
      data: {com_id}
    })
  },
  getShopComments(data) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/evaluate",
      data
    })
  },
  getMsList(page) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/index/ms",
      data: {page}
    })
  },
  buyMs(goods_id) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/indent/buyMs",
      data: {goods_id}
    })
  },
  getMyMsList(state, page) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/indent/msList",
      data: {state, page}
    })
  },

  bindTechnician(orders_id, staff_id) {
    return Axios({
      loading: true,
      method: "POST",
      url: "/api/Technician/staffChange",
      data: {orders_id, staff_id}
    })
  },

  getOrderNum() {
    return Axios({
      method: "POST",
      url: "/api/indent/orderNum",
    })
  },
  getCommentNum(com_id,staff_id) {
    return Axios({
      method: "POST",
      url: "/api/index/evaluateNum",
      data: {com_id,staff_id}
    })
  },
  getJoinRecords(page) {
    return Axios({
      method: "POST",
      url: "/api/user/enter",
      data: {page}
    })
  },
  getLeaveRecords(page) {
    return Axios({
      method: "POST",
      url: "/api/Technician/holiday",
      data: {page}
    })
  },


}


export default Api